package constantes;

public class ConsultasDinamicasConstants {

	public static final String CONSULTAR_PERSONA ="select p from TPersona p " +
			"LEFT JOIN FETCH p.tTipDocumento ti " +
			"LEFT JOIN FETCH p.tActEconomica act " +
			"LEFT JOIN FETCH p.tEmpresaSalud eps " +
			"LEFT JOIN FETCH p.tEstadoCivil est " +
			"LEFT JOIN FETCH p.TParentesco par " +
			"LEFT JOIN FETCH p.tCiudad ciud " +
			"LEFT JOIN FETCH ciud.TDepartamento dep " +
			"LEFT JOIN FETCH p.tGenero gen ";
	
	public static final String CONSULTAR_PERSONA_PARAM_NUMERO_IDENTIFICACION =" p.numDocumento=:numeroIdentificacion ";
	public static final String CONSULTAR_PERSONA_PARAM_PRIMER_NOMBRE =" lower(p.desPrinombre)=lower(:nombre) ";
	public static final String CONSULTAR_PERSONA_PARAM_TIPO_DOCUMENTO =" p.tTipDocumento.idTipDocumento=:tipoIdentificacion ";
	public static final String CONSULTAR_PERSONA_PARAM_SEGUNDO_NOMBRE =" lower(p.desSegnombre)=lower(:segundoNombre) ";
	public static final String CONSULTAR_PERSONA_PARAM_PRIMER_APELLIDO =" lower(p.desPriapellido)=lower(:primerApellido) ";
	public static final String CONSULTAR_PERSONA_PARAM_SEGUNDO_APELLIDO =" lower(p.desSegapellido)=lower(:segundoApellido) ";
	public static final String CONSULTAR_PERSONA_PARAM_HISTORIA_CLINICA =" p.numDocumento=:historiaClinica ";
	public static final String CONSULTAR_PERSONA_PARAM_ORDER_BY =" ORDER BY p.idPersona DESC ";
	

	public static final String WHERE =" WHERE ";
	public static final String AND =" AND ";
	
	public static final String CONSULTAR_CONTROL = "SELECT c FROM TControl c JOIN FETCH c.tPersona per";
	public static final String CONSULTAR_CONTROL_PARAM_FECHA_INICIO = " c.feControl >=:fechaInicio ";
	public static final String CONSULTAR_CONTROL_PARAM_FECHA_FIN = " c.feControl <=:fechaFin ";
	public static final String CONSULTAR_CONTROL_PARAM_ID_PERSONA = " c.tPersona.idPersona =:idPersona ";
	public static final String CONSULTAR_CONTROL_PARAM_ORDER_BY = " ORDER BY c.idControl DESC ";
	
	public static final String CONSULTAR_FECHA_CONTROL = "SELECT NEW dto.RegistroIndividualDTO (c.feControl, count(c.feControl)) FROM TControl c ";
	public static final String CONSULTAR_CONTROL_PARAM_GROUP_BY = " GROUP BY c.feControl  ORDER BY c.feControl DESC";
	
	public static final String CONSULTAR_MEDICAMENTO = "SELECT m FROM TCatalogoMedicamento m ";
	public static final String CONSULTAR_MEDICAMENTO_PARAM_TIPO_MEDICAMENTO = " m.tipoMed =:tipoMed";
	public static final String CONSULTAR_MEDICAMENTO_PARAM_GENERICO = " m.nomGen =:nomGen ";
	public static final String CONSULTAR_MEDICAMENTO_PARAM_PRESENTACION = " m.desPres =:desPres ";
	public static final String CONSULTAR_MEDICAMENTO_PARAM_COMERCIAL = " m.nomCom =:nomCom ";
	public static final String CONSULTAR_MEDICAMENTO_PARAM_ORDER_BY =" ORDER BY m.idCatalogoMedicamento DESC ";
	
	public static final String CONSULTAR_MEDICAMENTO_CONTROL = "SELECT m FROM TCatalogoMedicamento m ";
	
	public static final String CONSULTAR_PROFESIONAL ="select p from TProfesional p ";
	public static final String CONSULTAR_PROFESIONAL_PARAM_NUMERO_IDENTIFICACION =" p.desNit=:nit ";
	public static final String CONSULTAR_PROFESIONAL_PARAM_ORDER_BY =" ORDER BY p.idProfesional DESC ";
	
}
